import java.util.List;

public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode treeNode = binaryTree.createTree();
        System.out.println(treeNode.val);
        binaryTree.preOrder(treeNode);
        System.out.println();
        List<Character> list1 = binaryTree.preorderTraversal1(treeNode);
        for (int i = 0; i < list1.size(); i++) {
            System.out.print(list1.get(i) + " ");
        }
        System.out.println();
        List<Character> list2 = binaryTree.inorderTraversal(treeNode);
        for (int i = 0; i < list2.size(); i++) {
            System.out.print(list2.get(i) + " ");
        }
        System.out.println();
        List<Character> list3 = binaryTree.postorderTraversal(treeNode);
        for (int i = 0; i < list3.size(); i++) {
            System.out.print(list3.get(i) + " ");
        }
        System.out.println();
        System.out.println("叶子节点的数目：");
        int leaf = binaryTree.getLeafNodeCount1(treeNode);
        System.out.println(leaf);
        int leaf2 = binaryTree.getLeafNodeCount2(treeNode);
        System.out.println(leaf2);
        System.out.println("第K层的节点个数为：");
        System.out.println(binaryTree.getKLevelNodeCount(treeNode,4));
        System.out.println("二叉树的高度为：");
        System.out.println(binaryTree.getHeight1(treeNode));
        System.out.println(binaryTree.getHeight2(treeNode));
        BinaryTree.TreeNode treeNode1 = binaryTree.find(treeNode,'E');
        System.out.println(treeNode1.val);
    }
}
